/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-22 08:55:39
 * @FilePath: \campus-repair-platform\server\routes\common\announce.js
 */
const express = require("express")
// 创建路由对象
const router = express.Router()

const announceService = require("../../service/common/announce")
const repairService = require("../../service/common/repair")
const repairTypeService = require("../../service/common/repair_type")
const repairerTypeService = require("../../service/manage/repairer_type")
const repairerService = require("../../service/common/repairer")
const recordService = require("../../service/common/maintenance_record")
const areaService = require("../../service/manage/area")

// 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入需要的验证规则对象
const { id_p_schema, job_number } = require("../../schema/common")
const { list_schema, query_schema } = require("../../schema/common/announce")

// 获取公告列表
router.get("/announce/", expressJoi(list_schema), announceService.getAnnounceList)
// 根据title模糊查询公告
router.get("/announce/query", expressJoi(query_schema), announceService.queryAnnounceList)
// 获取公告信息
router.get("/announce/:id", expressJoi(id_p_schema), announceService.getInfoAnnounce)

// 获取维修人员信息
router.get("/repairer/:r_number", expressJoi({ params: { r_number: job_number } }), repairerService.getInfoRepairer)

// 获取维修人员类型信息
router.get("/repairer_type/:id", expressJoi(id_p_schema), repairerTypeService.getInfoRepairerType)

// 获取报修区域信息
router.get("/area/:id", expressJoi(id_p_schema), areaService.getInfoArea)
// 获取报修区域列表(报修管理)
router.get("/area", areaService.screenAreaList)

// 获取报修类型信息
router.get("repair_type/:id", expressJoi(id_p_schema), repairTypeService.getInfoRepairType)
// 获取报修类型列表
router.get("/repair_type", repairTypeService.getRepairTypeList)

// 获取报修单信息
router.get("/repair/:id", expressJoi(id_p_schema), repairService.getInfoRepair)
// 获取报修单数量
router.get("/cont", repairService.getStateCont)

// 获取维修记录信息
router.get("/record/:id", expressJoi(id_p_schema), recordService.getInfoRecord)

module.exports = router
